package ysu.sxm.ptjc.Dao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import ysu.sxm.ptjc.pojo.ProRelationInfo;
import ysu.sxm.ptjc.pojo.ProduceInfo;

import java.util.Set;

@Repository
public interface ProduceDao {
    @Insert("insert into pro_relation_info values (#{proRelaInfo.produceNum}," +
            "#{proRelaInfo.customerId}," +
            "#{proRelaInfo.color}," +
            "#{proRelaInfo.carTypeId}," +
            "#{proRelaInfo.workshopId})")
    int insertPri(@Param("proRelaInfo")ProRelationInfo pri);

    @Insert("insert into produce_info(produce_type, produce_num, line_id, produce_date, `group`, produce_name) values (\n" +
            "#{pI.produceType},\n" +
            "#{pI.produceNum},\n" +
            "#{pI.lineId},\n" +
            "#{pI.produceDate},\n" +
            "#{pI.group},\n" +
            "#{pI.produceName}\n" +
            ");")
    int insertPi(@Param("pI")ProduceInfo produceInfo);

    @Select("select produce_num from pro_relation_info")
    Set<String> selectAllPn();
}
